home *** CD-ROM | disk | FTP | other *** search
- /**********************************************************************\
-
- File: speedy mouse VBL.c
-
- Purpose: This module handles setting low-level globals that make
- the mouse move twice as fast as normal.
-
-
- Speedy Mouse -=- all the mouse and twice the speed
- Copyright (C) 1993 Mark Pilgrim
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program in a file named "GNU General Public License".
- If not, write to the Free Software Foundation, 675 Mass Ave,
- Cambridge, MA 02139, USA.
-
- \**********************************************************************/
-
- #include "Retrace.h"
- #include "GestaltEQU.h"
-
- extern Boolean CrsrNew : 0x8CE;
- extern Point mTemp : 0x828;
- extern Point RawMouse : 0x82C;
- extern unsigned int keymap[8] : 0x174;
- extern Rect ts: 0x09ce;
-
- Rect gMainScreenBounds;
- unsigned long me;
- int oldX, oldY;
-
- void header(void);
- void main(void);
-
- void header(void)
- {
- asm {
- dc.l 0
- move.l a0, d0
- lea header, a0
- jmp main
- }
- }
-
- #include "SetUpA4.h"
-
- void main(void)
- {
- VBLTask* myVBL;
- int vx,vy;
- long gestalt_temp;
- OSErr isHuman;
-
- RememberA0();
- SetUpA4();
-
- asm
- {
- move.l d0, myVBL
- }
-
- if (me != '©MSG')
- {
- me = '©MSG';
- oldX=RawMouse.h;
- oldY=RawMouse.v;
- isHuman = Gestalt(gestaltQuickdrawVersion, &gestalt_temp);
- gMainScreenBounds=(isHuman || (gestalt_temp < gestalt8BitQD)) ? screenBits.bounds :
- (**GetMainDevice()).gdRect;
- }
-
- vx=RawMouse.h-oldX;
- vy=RawMouse.v-oldY;
-
- if ((vx>=-200) && (vx<=200) && (vy>=-200) && (vy<=200) && ((vx!=0) || (vy!=0)) &&
- (!(keymap[3]&2)))
- {
- if (PtInRect(RawMouse, &gMainScreenBounds))
- {
- if (RawMouse.h+vx<gMainScreenBounds.left)
- vx=gMainScreenBounds.left-RawMouse.h;
- else if (RawMouse.h+vx>=gMainScreenBounds.right)
- vx=gMainScreenBounds.right-RawMouse.h-1;
- if (RawMouse.v+vy<gMainScreenBounds.top)
- vy=gMainScreenBounds.top-RawMouse.v;
- else if (RawMouse.v+vy>=gMainScreenBounds.bottom)
- vy=gMainScreenBounds.bottom-RawMouse.v-1;
- }
-
- RawMouse.h+=vx;
- mTemp.h+=vx;
- RawMouse.v+=vy;
- mTemp.v+=vy;
-
- CrsrNew = TRUE;
- }
-
- oldX=RawMouse.h;
- oldY=RawMouse.v;
-
- myVBL->vblCount = 1;
- RestoreA4();
- }
-